#include "Object.hpp"

namespace maploader
{
	Object::Object() : myName(""), myType(""), myX(0), myY(0), myWidth(0), myHeight(0), myGID(-1) {}

	Object Object::Load(const pugi::xml_node& node)
	{
		Object object;
		object.myGID = node.attribute("gid").as_int();
		object.myX = node.attribute("x").as_uint();
		object.myY = node.attribute("y").as_uint();
		object.myWidth = node.attribute("width").as_uint();
		object.myHeight = node.attribute("height").as_uint();
		object.myName = std::string(node.attribute("name").value());
		object.myType = std::string(node.attribute("type").value());

		return object;
	}
}